package com.example.testproject.template

import android.content.Context
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.animation.BaseAnimation
import com.example.testproject.adapter.SelectDepartmentAdapter
import com.example.testproject.base.BaseRecyclerViewTemplate
import com.example.testproject.bean.SelectBean

/**
 *
 * @ClassName: SelectDepartmentTemplate
 * @Author: android 超级兵
 * @CreateDate: 12/17/21$ 11:11 AM$
 * TODO
 */

class SelectDepartmentTemplate(val data: List<List<SelectBean.Data>>) :
    BaseRecyclerViewTemplate() {

    private lateinit var adapter: SelectDepartmentAdapter
    override fun buildAdapter() = let {
        SelectDepartmentAdapter(data)
    }.apply {
        adapter = this
    }

    override fun getAdapter(): RecyclerView.Adapter<*> = adapter

    override fun buildLayoutManager(context: Context?): RecyclerView.LayoutManager {
        return LinearLayoutManager(
            context,
            RecyclerView.HORIZONTAL, false
        )
    }

    override fun getAnimation(): BaseAnimation {
        return BaseAnimation { arrayOfNulls(0) }
    }
}